
<template>
  <div class="icons">
    <i v-for="(icon, i) in icons" :key="i" class="vp-ico16" :class="icon"></i>
  </div>
</template>

<script>
export default {
  props: {
    item: [],
  },
  data() {
    return {};
  },
  computed: {
    icons() {
      return this.getNewsIcons()
    },
  },
  methods: {
    // 判断当前应该展示哪些图标
    getNewsIcons() {
      let iconArr = [];
      let data = this.item
      if (
        data.importantLevel != null &&
        data.importantLevel != "" &&
        (data.importantLevel == 2 ||
          data.importantLevel == 3 ||
          data.importantLevel == 4 ||
          data.importantLevel == 5)
      ) {
        iconArr.push(`important${data.importantLevel}_16`);
      }
      //附件
      if (data.hasAttachments === true) {
        iconArr.push("vp-attachment");
      }
      //视频图标 1普通会议 2视频会议
      if (data.meetingNature === "2") {
        iconArr.push("bodyType_videoConf_16");
      }
      //协同类型
      if (
        data.bodyType !== "" &&
        data.bodyType !== null &&
        data.bodyType !== "10" &&
        data.bodyType !== "30" &&
        data.bodyType !== "HTML"
      ) {
        var bodyType = data.bodyType;
        var bodyTypeClass = this.convertPortalBodyType(bodyType);
        if (bodyTypeClass != "html_16") {
          iconArr.push(bodyTypeClass);
        }
      }
      if (data.showClockIcon == true && data.dealTimeout === true) {
        iconArr.push("extended_red_16");
      } else if (data.showClockIcon == true && data.overTime === false) {
        iconArr.push("extended_blue_16");
      }
      return iconArr;
    },
    
    convertPortalBodyType(bodyType) {
      var bodyTypeClass = "html_16";
      if ("FORM" == bodyType || "20" == bodyType) {
        // bodyTypeClass = "form_text_16";
      } else if ("TEXT" == bodyType || "30" == bodyType) {
        bodyTypeClass = "vp-txt_16";
      } else if ("OfficeWord" == bodyType || "41" == bodyType) {
        bodyTypeClass = "vp-doc_16";
      } else if ("OfficeExcel" == bodyType || "42" == bodyType) {
        bodyTypeClass = "vp-xls_16";
      } else if ("WpsWord" == bodyType || "43" == bodyType) {
        bodyTypeClass = "vp-WpsWord";
      } else if ("WpsExcel" == bodyType || "44" == bodyType) {
        bodyTypeClass = "vp-xls2_16";
      } else if ("Pdf" == bodyType || "45" == bodyType) {
        bodyTypeClass = "vp-pdf_16";
      } else if ("Ofd" == bodyType || "46" == bodyType) {
        bodyTypeClass = "vp-office-consumable";
      } else if ("videoConf" == bodyType) {
        bodyTypeClass = "vp-videoconferencing";
      }
      return bodyTypeClass;
    },
  },
};
</script>
<style scoped lang="scss">
.icons {
  display: inline-block;
  margin-right: 5px;

  .vportal.form_text_16 {
    color: #59c63a !important;
  }

  .vp-ico16 {
    color: #8ed04b !important;
  }

  .vp-ico16.important2_16,
  .vp-ico16.important3_16,
  .vp-ico16.important4_16,
  .vp-ico16.important5_16 {
    color: red !important;
  }

  .vp-section-attachment {
    color: #ef985e !important;
  }

  .vp-ico16.extended_red_16 {
    color: #ff6c00 !important;
  }

  .vp-ico16.vp-attachment,
  .vp-ico16.affix_16,
  .vp-ico16.vp-section-attachment {
    color: #f4935c !important;
  }

  .vp-ico16.vp-signature_16,
  .vp-ico16.signature_16 {
    color: #38adde !important;
  }

  .vp-ico16.vp-specify_fallback_16,
  .vp-ico16.specify_fallback_16 {
    color: #ff6c00 !important;
  }

  .vp-ico16.vp-extended_blue_16,
  .vp-ico16.extended_blue_16 {
    color: #8ed04b;
  }

  .vp-ico16.vp-extended_red_16,
  .vp-ico16.extended_red_16 {
    color: #f66c3e !important;
  }

  .vp-ico16.vp-liuchengbianji {
    color: #ff6c00 !important;
  }

  .vp-ico16.vp-flow3_16,
  .vp-ico16.vp-flow1_16,
  .vp-ico16.flow3_16,
  .vp-ico16.flow1_16 {
    color: #449bc0 !important;
  }

  .vp-ico16.vp-lately_flow_template_16,
  .vp-ico16.lately_flow_template_16 {
    color: #3498da !important;
  }

  .vp-ico16.vp-important2_16,
  .vp-ico16.important2_16,
  .vp-ico16.vp-important3_16 {
    color: #fb3a36 !important;
  }

  .vp-ico16.vp-task-milestone {
    color: #ff7905 !important;
  }

  .vp-ico16.vp-task-risk,
  .vp-ico16.vp-task-l-risk {
    color: #6cc4e9 !important;
  }

  .vp-ico16.vp-task-m-risk {
    color: #fab715 !important;
  }

  .vp-ico16.vp-task-h-risk {
    color: #fb3a36 !important;
  }

  .vp-ico16.vp-collaboration_16,
  .vp-ico16.vp-flow_template_16,
  .vp-ico16.collaboration_16,
  .vp-ico16.flow_template_16 {
    color: #377ef0 !important;
  }

  .vp-ico16.vp-red_text_template_16,
  .vp-ico16.vp-meeting_inform_16,
  .vp-ico16.red_text_template_16,
  .vp-ico16.meeting_inform_16 {
    color: #6dc82f !important;
  }

  .vp-ico16.vp-overduematters,
  .vp-ico16.overduematters {
    color: #f66c3e !important;
  }

  .vp-ico16.vp-xls2_16,
  .vp-ico16.xls2_16,
  .vp-ico16.Office44_16,
  .vp-ico16.office44_16,
  .vp-ico16.officexls2_16,
  .WpsExcel {
    color: #4bb36c !important;
  }

  .vp-ico16.vp-WpsWord,
  .vp-ico16.WpsWord,
  .vp-ico16.wps_16,
  .vp-ico16.Office43_16,
  .vp-ico16.office43_16,
  .vp-ico16.officewps_16,
  .WpsWord {
    color: #36b6d0 !important;
  }

  .vp-ico16.vp-txt_16,
  .vp-ico16.txt_16,
  .vp-ico16.officetxt_16 {
    color: #ffcd4a !important;
  }

  .vp-ico16.vp-pdf_16,
  .vp-ico16.pdf_16,
  .vp-ico16.Office45_16,
  .vp-ico16.office45_16,
  .vp-ico16.officepdf_16,
  .Pdf {
    color: #f46065 !important;
  }

  .Ofd {
    color: #f46065 !important;
  }

  .vp-ico16.vp-doc_16,
  .vp-ico16.officedoc_16,
  .vp-ico16.doc_16,
  .vp-ico16.Office41_16,
  .vp-ico16.office41_16,
  .vp-ico16.officedoc_16,
  .OfficeWord {
    color: #3890de !important;
  }

  .vp-ico16.vp-xls_16,
  .vp-ico16.xls_16,
  .vp-ico16.Office42_16,
  .vp-ico16.office42_16,
  .vp-ico16.officexls_16,
  .OfficeExcel {
    color: #4bb36c !important;
  }
}
</style>
